{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=3392
  Verdict: Accepted
}
var a:array[0..30,0..30] of longint; i,j,n,m,c:longint;
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
read(n,m);
c:=0;
for j:=1 to m do 
	for i:=1 to n do begin
    inc(c);
		a[i][j]:=c;
	end;
for i:=1 to n do begin
	for j:=1 to m do 
		write(a[i][j],' ');
	writeln;
end;
end.